<?php 
class CBaseEosSingular {

	public function __construct() {		
		return true;
	}
	
	public function insertRecord( $strSql, $objDatabase ) {
		$intId = $objDatabase->insert( $strSql );
		$this->setId( $intId );
		
		if(	false == isset( $intId ) ) {
			return fasle;	
		}		
		return true;
	}
	
	public function updateRecord( $strSql, $objDatabase ) {	
		return $objDatabase->update( $strSql );
	}
	
	public function deleteRecord( $strSql, $objDatabase ) {
		return $objDatabase->delete( $strSql );
	}
	
	public function validate( $arrmixFormFields, $arrmixValidateFields ) {
		$boolIsValid = true;
		$objErrorMessage = new CErrorMessage();
		if( true == valArr( $arrmixValidateFields ) ) {
			foreach( $arrmixValidateFields as $mixValidateField ) {
				
				if( true == array_key_exists( $mixValidateField , $arrmixFormFields ) ) {	
				
					$strValue = $arrmixFormFields[$mixValidateField];			
					if( false == isset( $strValue ) || true == is_null( $strValue ) || 0 == strlen( $strValue ) ) {
						$strFieldName = str_replace( '_', ' ', $mixValidateField );
						$strErrorMessage = 'Please enter ' .  $strFieldName;
						$objErrorMessage->setErrorMessage( $strErrorMessage );
						$boolIsValid = false;
					}					
				}					
			}
		}
		return $boolIsValid;
	}
}

?>